package com.powernode.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.powernode.domain.ProdComm;
import com.powernode.mapper.ProdCommMapper;
import com.powernode.service.ProdCommService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ProdCommServiceImpl extends ServiceImpl<ProdCommMapper, ProdComm> implements ProdCommService {
    @Autowired
    private ProdCommMapper prodCommMapper;
    /*
     * 回复和审核商品的评论
     * @author RenBoQing
     * @date 2024/7/28 11:28
     * @param productComm
     * @return boolean
     */
    @Override
    public boolean replyAndExamProdComm(ProdComm productComm) {
        // 获取商品评论的内容
        String content = productComm.getContent();
        if (content != null && content.length() > 0) {
                // 设置回复状态为已回复
                productComm.setReplySts(1);
                // 设置回复时间
                productComm.setReplyTime(productComm.getCreateTime());
        }
        return prodCommMapper.updateById(productComm)>0;
    }
}